import { _ as __nuxt_component_0 } from './nuxt-link-e8ce45ca.mjs';
import { useSSRContext, defineComponent, withAsyncContext, mergeProps, unref, withCtx, createTextVNode, toDisplayString } from 'vue';
import { _ as _export_sfc, u as useRoute, a as useHead, b as useSeoMeta } from '../server.mjs';
import { u as useServerRequest } from './useServerRequest-5f9c762f.mjs';
import { ssrRenderAttrs, ssrRenderList, ssrRenderComponent, ssrInterpolate, ssrRenderStyle, ssrRenderAttr, ssrRenderClass } from 'vue/server-renderer';
import moment from 'moment';
import { c as coms } from './index-93a12165.mjs';
import 'node:http';
import 'node:https';
import '../../nitro/node-server.mjs';
import 'fs';
import 'path';
import 'node:fs';
import 'node:url';
import '@unhead/shared';
import 'vue-router';
import '../../index.mjs';
import 'unhead';
import 'tailwind-merge';
import 'highlight.js';

const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  __ssrInlineRender: true,
  async setup(__props) {
    let __temp, __restore;
    let pageSize = useRoute().query.pageSize || 10;
    let pageNum = useRoute().query.pageNum || 1;
    console.log(pageSize, pageNum);
    const { data: info } = ([__temp, __restore] = withAsyncContext(() => useServerRequest("article/list", {
      method: "POST",
      body: { pageNo: +pageNum, pageSize: +pageSize }
    })), __temp = await __temp, __restore(), __temp);
    const { data: siteInfo } = ([__temp, __restore] = withAsyncContext(() => useServerRequest("sites/info", {
      method: "POST",
      body: {}
    })), __temp = await __temp, __restore(), __temp);
    console.log(siteInfo.value.result.seo, "siteInfo");
    useHead({
      link: [
        { rel: "shortcut icon", href: siteInfo.value.result.logoUrl },
        { rel: "apple-touch-icon", href: siteInfo.value.result.logoUrl },
        { ref: "icon", type: "image/x-icon", href: siteInfo.value.result.logoUrl, "data-rh": true }
      ],
      meta: [{ name: "twitter:card", content: "summary_large_image" }]
    });
    useSeoMeta({
      title: siteInfo.value.result.name,
      description: siteInfo.value.result.description,
      keywords: siteInfo.value.result.keywords,
      ogImage: siteInfo.value.result.logoUrl,
      referrer: "no-referrer"
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_NuxtLink = __nuxt_component_0;
      _push(`<div${ssrRenderAttrs(mergeProps({ id: "app" }, _attrs))} data-v-37fa8fc3><div class="page-body" data-v-37fa8fc3><ul class="list" data-v-37fa8fc3><!--[-->`);
      ssrRenderList(unref(info).result.data, (item, index2) => {
        _push(`<li class="list-item" data-v-37fa8fc3><div class="list-item-left" data-v-37fa8fc3>`);
        _push(ssrRenderComponent(_component_NuxtLink, {
          to: `/detail/${item.serialNo}`,
          class: "list-item-title"
        }, {
          default: withCtx((_, _push2, _parent2, _scopeId) => {
            if (_push2) {
              _push2(`${ssrInterpolate(item.title)}`);
            } else {
              return [
                createTextVNode(toDisplayString(item.title), 1)
              ];
            }
          }),
          _: 2
        }, _parent));
        _push(`<p class="list-item-desc m-oh-2" data-v-37fa8fc3>${ssrInterpolate(item.summary)}</p><p class="list-item-footer" data-v-37fa8fc3><span class="iconfont lishixiao m-margin-right4" style="${ssrRenderStyle({ "font-size": "12px" })}" data-v-37fa8fc3></span><span data-v-37fa8fc3>${ssrInterpolate(unref(moment)(item.updateTime).format("yyyy-MM-DD HH:mm:ss"))}</span><span style="${ssrRenderStyle({ "margin-left": "16px", "font-size": "12px" })}" class="iconfont yueduxiao m-margin-right4" data-v-37fa8fc3></span><span data-v-37fa8fc3>${ssrInterpolate(item.viewsCount)}</span></p></div>`);
        if (item.coverImageUrl) {
          _push(`<img${ssrRenderAttr("src", item.coverImageUrl)} alt="" style="${ssrRenderStyle({ "width": "100px", "height": "100px", "margin-left": "20px", "border-radius": "8px" })}" data-v-37fa8fc3>`);
        } else {
          _push(`<!---->`);
        }
        _push(`</li>`);
      });
      _push(`<!--]--><div class="m-flex-r m-margin-top m-ai-c m-jc-c" data-v-37fa8fc3><!--[-->`);
      ssrRenderList(Math.floor(unref(info).result.total / unref(pageSize)), (item, index2) => {
        _push(`<a class="${ssrRenderClass([index2 + 1 == unref(pageNum) ? "page-num-active" : "", "page-num"])}"${ssrRenderAttr("href", `/?pageNum=${index2 + 1}`)} data-v-37fa8fc3>${ssrInterpolate(index2 + 1)}</a>`);
      });
      _push(`<!--]--></div></ul>`);
      _push(ssrRenderComponent(unref(coms), {
        coms: unref(siteInfo).result.components
      }, null, _parent));
      _push(`</div></div>`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/index/index.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-37fa8fc3"]]);

export { index as default };
//# sourceMappingURL=index-8ec40aba.mjs.map
